<?php

namespace IDock\Insurance\ZMBX\Request;

use IDock\Insurance\ZMBX\ZMBXEnums;
use IDock\Insurance\ZMBX\Request\AllZMBXRequest;
use IDock\Insurance\ZMBX\Response\UnderwritingResponse;
use IDock\Visitor\Premium\PremiumInquiryVisitor;
use IDock\Visitor\SpecialClausesVisitor;

class UnderwritingRequest extends AllZMBXRequest
{
    public $route = 'Submit.do';
    public $requestCode = 'Submit';

    protected $response = UnderwritingResponse::class;

    protected $urlTip = '提交核保';

    /*** @var  PremiumInquiryVisitor $visitor */
    protected $visitor;

    public $passMsgUrl;
    public $callbackUrl;

    public function generate(): array
    {
        $this->setZMBXToken($this->visitor->getExtInfoVisitor()->argc);
        $ip = explode(':',$this->proxy);
        if(!$ip){
            throw new \Exception("缺少必要参数：IP");
        }
        $ip = array_shift($ip);
        $arr = [
            'businessNo' => $this->visitor->getUnderwritingVisitor()->inquiryNo,
            'callbackUrl' => $this->callbackUrl,
            'passMsgUrl' => $this->passMsgUrl,
            'engageInfo' => new \stdClass(),
            'busSrePcIP' => $ip,
        ];
        return $arr;
    }



}
